<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
	<head>
	    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	    <meta http-equiv="Content-Style-Type" content="text/css" />
	    <meta http-equiv="Content-Language" content="fr" />
	    <title>API CoMeet</title>
	    <script language="javascript" type="text/javascript">
	    var mail;
	    var msg;
	    	function update(ct) 
	    	{
		    	mail = encodeURIComponent(ct.mail.value);
		    	msg = encodeURIComponent(ct.msg.value);
	    		getLocation();   		   		
	    	}
	   		function getLocation() {
	   			alert('Please Wait');
				// Get location no more than 10 minutes old. 600000 ms = 10 minutes.
				navigator.geolocation.getCurrentPosition(registerLoc, showError, {enableHighAccuracy:true,maximumAge:600000});
			}
 
			function showError(error) {
				alert(error.code + ' ' + error.message);
			}
 
			function registerLoc(position) 
			{
				location.href = "traitement.php?type=write&id="+mail+"&lat="+position.coords.latitude+"&long="+position.coords.longitude+"&msg="+msg;
			}
			function view(ct) 
			{
				id = encodeURIComponent(ct.mail.value);
				location.href = "traitement.php?type=read&id="+id;
			}
		</script>
	</head>
		
	<body>
			<h2>Update position</h2>
			<form  action="" method="POST" onSubmit="update(this); return false;">
				<label for='mail'>Email : </label><input type='text' name='mail' id='mail'/><br />
				<label for='msg'>Message : </label><textarea name='msg' id='msg'></textarea><br />
				<script language="javascript" type="text/javascript">	
						if (navigator.geolocation) {  
							document.write('<input type="submit" value="UPDATE" />');
						} else {  
							document.write('<p>Sorry but your browser does not support the geolocation</p>');  
						}  
				</script>
			</form>
			<h2>Localize</h2>
			<form  action="" method="POST" onSubmit="view(this); return false;">
				<label for='mail'>Email : </label><input type='text' name='mail' id='mail'/><br />
				<input type="submit" value="VIEW" />
			</form>
		<div id="my_map" style="width: 600px; height: 350px"></div>
	</body>
</html>